import time
from selenium import webdriver
from selenium.webdriver.common.by import By


d = webdriver.Chrome()
d.get('https://www.qq.com')
d.maximize_window()
time.sleep(1)

s_ele = d.find_element(By.CSS_SELECTOR, '[id="searchBtn"]')
res = s_ele.is_displayed()  # is_displayed()方法，显示返回Ture，不显示返回False
print(res)

# 隐藏元素：只能定位，不能操作

# 执行js语句  JavaScript
# window.scrollTo(o,与顶部的距离)，拉动窗口的滚动条
js = "window.scrollTo(0,100);"
d.execute_script(js)
time.sleep(5)

d.quit()
